package com.zhl.learnDH_class.Learn2

object Test2 {
  //计算100——999的水仙花所有数字
  def main(args: Array[String]): Unit = {
    for (i <- 100 to 999) {
      val hundreds = i / 100
      val tens = (i - hundreds * 100) / 10
      val ones = i - hundreds * 100 - tens * 10
      if (i == hundreds * hundreds * hundreds + tens * tens * tens + ones * ones * ones) {
        println(i)
      }

    }
  }
}
